# 学生年龄处理

stu_ages=[21,25,21,23,22,20]

stu_ages.append(31)
print(stu_ages)

stu_ages.extend([29,33,20])
print(stu_ages)

first=stu_ages.pop(0)
print(first)

last=stu_ages.pop(len(stu_ages)-1)
print(last)

print(f"now={stu_ages}")

find_index=stu_ages.index(31)
print(find_index)

# 遍历
i=0
while i<len(stu_ages):
    print(f"第{i+1}个元素是{stu_ages[i]}")
    i+=1

# 同时遍历索引与元素
for idx,age in enumerate(stu_ages):
    print(idx,age)
